﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

namespace BitworkStudios.Web.Mvc.Framework.Configuration
{
    public abstract class ConfigurationBase : IConfiguration
    {
        protected ConfigurationBase(string sectionGroupName)
        {
            _sectionGroupName = sectionGroupName;
        }

        private readonly string _sectionGroupName;
        public abstract string SectionName { get; }
        private string SectionPath
        {
            get { return string.Format("{0}/{1}", _sectionGroupName, SectionName); }
        }

        private Hashtable ConfigHashtable
        {
            get
            {
                return (Hashtable)ConfigurationManager.GetSection(SectionPath);
            }
        }

        protected Hashtable SectionHashTable
        {
            get
            {
                return (Hashtable)ConfigHashtable[SectionName];
            }
        }
    }
}
